{% extends "template/addEdit.volt" %}

{% block title %}新建用户{% endblock %}

{% block content %}
    <table class="single">
        <tr>
            <th>手机号:</th>
            <td><input type="text" value="" name="phone" autocomplete="off" data-valid="phone"/></td>
        </tr>
        <tr>
            <th>密码:</th>
            <td><input type="password" value="" name="password" autocomplete="off" id="password" data-valid="text"/>
            </td>
        </tr>
        <tr>
            <th>确认密码:</th>
            <td><input type="password" value="" id="confirmpassword" autocomplete="off" data-valid="text"/></td>
        </tr>
    </table>
{% endblock %}

{% block jscontent %}
    <script>
        function addAction() {
            if (DataValidBinder.valid()) {
                if ($("#password").val() == $("#confirmpassword").val()) {
                    var params = "action_key=ACTION_ADD&" + $("form").serialize();
                    $.post("/user/addUser", params, function (result) {
                        if (result.status == 0) {
                            FAlert(result.message, function (con) {
                                window.location.reload();
                            });
                        } else {
                            FAlert(result.message);
                        }

                    });
                } else {
                    FAlert("两次密码不一致");
                }
            }
        }
    </script>
{% endblock %}
